#ifndef __UTIL__PALETTE_HPP__
#define __UTIL__PALETTE_HPP__

#include <string>
#include <QGLWidget>
#include <util/colour.hpp>

namespace util {
  /** @brief A utility class for palettes.

      @todo The index constraints should be a constrained_value

      This class provides an interface for VLAB palette files
      and their use for OpenGL.
  */
  class palette {
  public:
    palette(std::string filename);

    void reread();

    void  use(unsigned int index);
    const colour& get(unsigned int index);
    void  blend(unsigned int ind1, unsigned int ind2, double w = 0.5);

  private:
    std::string filename;
    colour colours[256];
  };
}

#endif

